<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
 <head>
  <title>cgeql2.f</title>
 <meta name="generator" content="emacs 21.3.1; htmlfontify 0.20">
<style type="text/css"><!-- 
body { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default   { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.default a { background: rgb(255, 255, 255);  color: rgb(0, 0, 0);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.string   { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.string a { color: rgb(188, 143, 143);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
span.comment   { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: none; }
span.comment a { color: rgb(178, 34, 34);  background: rgb(255, 255, 255);  font-style: normal;  font-weight: 500;  font-stretch: normal;  font-family: adobe-courier;  font-size: 11pt;  text-decoration: underline; }
 --></style>

 </head>
  <body>

<pre>
      SUBROUTINE <a name="CGEQL2.1"></a><a href="cgeql2.f.html#CGEQL2.1">CGEQL2</a>( M, N, A, LDA, TAU, WORK, INFO )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  -- LAPACK routine (version 3.1) --
</span><span class="comment">*</span><span class="comment">     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
</span><span class="comment">*</span><span class="comment">     November 2006
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Scalar Arguments ..
</span>      INTEGER            INFO, LDA, M, N
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Array Arguments ..
</span>      COMPLEX            A( LDA, * ), TAU( * ), WORK( * )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Purpose
</span><span class="comment">*</span><span class="comment">  =======
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  <a name="CGEQL2.17"></a><a href="cgeql2.f.html#CGEQL2.1">CGEQL2</a> computes a QL factorization of a complex m by n matrix A:
</span><span class="comment">*</span><span class="comment">  A = Q * L.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Arguments
</span><span class="comment">*</span><span class="comment">  =========
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  M       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of rows of the matrix A.  M &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  N       (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The number of columns of the matrix A.  N &gt;= 0.
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  A       (input/output) COMPLEX array, dimension (LDA,N)
</span><span class="comment">*</span><span class="comment">          On entry, the m by n matrix A.
</span><span class="comment">*</span><span class="comment">          On exit, if m &gt;= n, the lower triangle of the subarray
</span><span class="comment">*</span><span class="comment">          A(m-n+1:m,1:n) contains the n by n lower triangular matrix L;
</span><span class="comment">*</span><span class="comment">          if m &lt;= n, the elements on and below the (n-m)-th
</span><span class="comment">*</span><span class="comment">          superdiagonal contain the m by n lower trapezoidal matrix L;
</span><span class="comment">*</span><span class="comment">          the remaining elements, with the array TAU, represent the
</span><span class="comment">*</span><span class="comment">          unitary matrix Q as a product of elementary reflectors
</span><span class="comment">*</span><span class="comment">          (see Further Details).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  LDA     (input) INTEGER
</span><span class="comment">*</span><span class="comment">          The leading dimension of the array A.  LDA &gt;= max(1,M).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  TAU     (output) COMPLEX array, dimension (min(M,N))
</span><span class="comment">*</span><span class="comment">          The scalar factors of the elementary reflectors (see Further
</span><span class="comment">*</span><span class="comment">          Details).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  WORK    (workspace) COMPLEX array, dimension (N)
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  INFO    (output) INTEGER
</span><span class="comment">*</span><span class="comment">          = 0: successful exit
</span><span class="comment">*</span><span class="comment">          &lt; 0: if INFO = -i, the i-th argument had an illegal value
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Further Details
</span><span class="comment">*</span><span class="comment">  ===============
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  The matrix Q is represented as a product of elementary reflectors
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Q = H(k) . . . H(2) H(1), where k = min(m,n).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  Each H(i) has the form
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     H(i) = I - tau * v * v'
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  where tau is a complex scalar, and v is a complex vector with
</span><span class="comment">*</span><span class="comment">  v(m-k+i+1:m) = 0 and v(m-k+i) = 1; v(1:m-k+i-1) is stored on exit in
</span><span class="comment">*</span><span class="comment">  A(1:m-k+i-1,n-k+i), and tau in TAU(i).
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">  =====================================================================
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     .. Parameters ..
</span>      COMPLEX            ONE
      PARAMETER          ( ONE = ( 1.0E+0, 0.0E+0 ) )
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Local Scalars ..
</span>      INTEGER            I, K
      COMPLEX            ALPHA
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. External Subroutines ..
</span>      EXTERNAL           <a name="CLARF.78"></a><a href="clarf.f.html#CLARF.1">CLARF</a>, <a name="CLARFG.78"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>, <a name="XERBLA.78"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Intrinsic Functions ..
</span>      INTRINSIC          CONJG, MAX, MIN
<span class="comment">*</span><span class="comment">     ..
</span><span class="comment">*</span><span class="comment">     .. Executable Statements ..
</span><span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     Test the input arguments
</span><span class="comment">*</span><span class="comment">
</span>      INFO = 0
      IF( M.LT.0 ) THEN
         INFO = -1
      ELSE IF( N.LT.0 ) THEN
         INFO = -2
      ELSE IF( LDA.LT.MAX( 1, M ) ) THEN
         INFO = -4
      END IF
      IF( INFO.NE.0 ) THEN
         CALL <a name="XERBLA.96"></a><a href="xerbla.f.html#XERBLA.1">XERBLA</a>( <span class="string">'<a name="CGEQL2.96"></a><a href="cgeql2.f.html#CGEQL2.1">CGEQL2</a>'</span>, -INFO )
         RETURN
      END IF
<span class="comment">*</span><span class="comment">
</span>      K = MIN( M, N )
<span class="comment">*</span><span class="comment">
</span>      DO 10 I = K, 1, -1
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Generate elementary reflector H(i) to annihilate
</span><span class="comment">*</span><span class="comment">        A(1:m-k+i-1,n-k+i)
</span><span class="comment">*</span><span class="comment">
</span>         ALPHA = A( M-K+I, N-K+I )
         CALL <a name="CLARFG.108"></a><a href="clarfg.f.html#CLARFG.1">CLARFG</a>( M-K+I, ALPHA, A( 1, N-K+I ), 1, TAU( I ) )
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">        Apply H(i)' to A(1:m-k+i,1:n-k+i-1) from the left
</span><span class="comment">*</span><span class="comment">
</span>         A( M-K+I, N-K+I ) = ONE
         CALL <a name="CLARF.113"></a><a href="clarf.f.html#CLARF.1">CLARF</a>( <span class="string">'Left'</span>, M-K+I, N-K+I-1, A( 1, N-K+I ), 1,
     $               CONJG( TAU( I ) ), A, LDA, WORK )
         A( M-K+I, N-K+I ) = ALPHA
   10 CONTINUE
      RETURN
<span class="comment">*</span><span class="comment">
</span><span class="comment">*</span><span class="comment">     End of <a name="CGEQL2.119"></a><a href="cgeql2.f.html#CGEQL2.1">CGEQL2</a>
</span><span class="comment">*</span><span class="comment">
</span>      END

</pre>

 </body>
</html>
